package com.tich.enumration;


/**
 * 通用状态枚举
 * */
public enum IsStatus {

    YES(1,"是"),
    NO(0,"否")
    ;

    private Integer code;

    private String msg;

    IsStatus(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return this.msg == null ? "" : this.msg;
    }

    public static String getMsg(Integer code) {
        for (IsStatus re : IsStatus.values()) {
            if (re.code.intValue() == code.intValue()) {
                return re.msg;
            }
        }
        return "";
    }

    public static IsStatus getRc(Integer code) {
        for (IsStatus re : IsStatus.values()) {
            if (re.code.intValue() == code.intValue()) {
                return re;
            }
        }
        return null;
    }

}
